<template>
    <div>
        <input  v-model="name">
        <input  v-model="info.city">
    </div>
</template>
<script>
export default {
    data() {
        return {
           name:'殷晨东',
           info:{
               city:'杭州'
           }
        }
    },
    watch: {
        name(oldVal,val){
            // 值类型可以正常拿到
            console.log('watch name',oldVal,val)
        },
        info:{
            // 引用类型，拿不到oldval,因为指针的已经指向newval
            handler(oldVal,val){
                console.log('watch info',oldVal,val)
            },
            deep:true //深度监听
        }
    },
}
</script>
<style>
    
</style>